﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:core="clr-namespace:InstantSpine.Core;assembly=InstantSpine.Core"
                    xmlns:mmodels="clr-namespace:InstantSpine.Core.MaterialModels;assembly=InstantSpine.Core"
                    xmlns:p="clr-namespace:InstantSpine.GUI.Properties"
                    xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit">
    <!-- template for iso lin elastic materials -->
    <DataTemplate DataType="{x:Type mmodels:IsoLinearElasticMaterial}">
        <Grid Margin="12, 0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto" MinWidth="120"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <TextBlock Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="4" Text="ISOTROPIC LINEAR ELASTIC MATERIAL PROPERTIES" Style="{StaticResource smallHeader}"/>
            <TextBlock Grid.Column="0" Grid.Row="1" Text="{x:Static p:Resources.YoungsModulus}" Margin="0,0,4,0" VerticalAlignment="Center"/>
            <TextBlock Grid.Column="1" Grid.Row="1" Text=" E = " FontStyle="Italic" VerticalAlignment="Center" TextAlignment="Right"/>
            <xctk:WatermarkTextBox Grid.Column="2" Grid.Row="1" TextAlignment="Right" VerticalAlignment="Center" Text="{Binding Path=YoungsModulus}" Watermark="{x:Static p:Resources.YoungsModulus}" WatermarkTemplate="{StaticResource wmTmplt}"/>
            <TextBlock Grid.Column="3" Grid.Row="1" Text=" MPa" VerticalAlignment="Center"/>
            <TextBlock Grid.Column="0" Grid.Row="2" Text="{x:Static p:Resources.PoissonsRatio}" Margin="0,0,4,0" VerticalAlignment="Center"/>
            <TextBlock Grid.Column="1" Grid.Row="2" Text=" ν = " FontStyle="Italic" VerticalAlignment="Center"/>
            <xctk:WatermarkTextBox Grid.Column="2" Grid.Row="2" TextAlignment="Right" VerticalAlignment="Center" Text="{Binding Path=PoissonsRatio}" Watermark="{x:Static p:Resources.PoissonsRatio}" WatermarkTemplate="{StaticResource wmTmplt}"/>
        </Grid>
    </DataTemplate>
    <!-- template for neo-hooke -->
    <DataTemplate DataType="{x:Type mmodels:NeoHookeanMaterial}">
        <Grid Margin="12, 0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto" MinWidth="120"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <TextBlock Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="4" Text="NEO-HOOKEAN MATERIAL PROPERTIES"  Style="{StaticResource smallHeader}"/>
            
            <TextBlock Grid.Column="0" Grid.Row="1" Text="Shear stiffness parameter" Margin="0,0,4,0" VerticalAlignment="Center"/>
            <TextBlock Grid.Column="1" Grid.Row="1" Text=" C₁₀ = " FontStyle="Italic" VerticalAlignment="Center" TextAlignment="Right"/>
            <xctk:WatermarkTextBox Grid.Column="2" Grid.Row="1" TextAlignment="Right" Text="{Binding Path=C10}" Watermark="Shear stiffness" WatermarkTemplate="{StaticResource wmTmplt}"/>
            <TextBlock Grid.Column="3" Grid.Row="1" Text=" MPa" VerticalAlignment="Center"/>
            
            <TextBlock Grid.Column="0" Grid.Row="2" Text="Compressibility parameter" Margin="0,0,4,0" VerticalAlignment="Center"/>
            <TextBlock Grid.Column="1" Grid.Row="2" TextAlignment="Right" Text=" D₁ = " FontStyle="Italic" VerticalAlignment="Center"/>
            <xctk:WatermarkTextBox Grid.Column="2" Grid.Row="2" TextAlignment="Right" Text="{Binding Path=D1}" Watermark="Compressibility" WatermarkTemplate="{StaticResource wmTmplt}"/>
            <TextBlock Grid.Column="3" Grid.Row="2" Text=" MPa^-1" VerticalAlignment="Center"/>

            <TextBlock Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="4" Text="Apparent linear elastic material properties:" Margin="0,12,0,8"/>

            <TextBlock Grid.Column="0" Grid.Row="4" Text="{x:Static p:Resources.YoungsModulus}" Margin="0,0,4,0" VerticalAlignment="Center"/>
            <TextBlock Grid.Column="1" Grid.Row="4" Text=" E = " FontStyle="Italic" VerticalAlignment="Center" TextAlignment="Right"/>
            <xctk:WatermarkTextBox Grid.Column="2" Grid.Row="4" TextAlignment="Right" VerticalAlignment="Center" Text="{Binding Path=ApparentYoungsModulus}" Watermark="{x:Static p:Resources.YoungsModulus}" WatermarkTemplate="{StaticResource wmTmplt}"/>            
            <TextBlock Grid.Column="3" Grid.Row="4" Text=" MPa" VerticalAlignment="Center"/>
            
            <TextBlock Grid.Column="0" Grid.Row="5" Text="{x:Static p:Resources.PoissonsRatio}" Margin="0,0,4,0" VerticalAlignment="Center"/>
            <TextBlock Grid.Column="1" Grid.Row="5" Text=" ν = " FontStyle="Italic" VerticalAlignment="Center" TextAlignment="Right"/>
            <xctk:WatermarkTextBox Grid.Column="2" Grid.Row="5" TextAlignment="Right" VerticalAlignment="Center" Text="{Binding Path=ApparentPoissonsRatio}" Watermark="{x:Static p:Resources.PoissonsRatio}" WatermarkTemplate="{StaticResource wmTmplt}"/>
        </Grid>
    </DataTemplate>
    <!-- template for hydraulic -->
    <DataTemplate DataType="{x:Type mmodels:HydraulicFluidMaterial}">
        <Grid Margin="12, 0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto" MinWidth="120"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <TextBlock Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="4" Text="HYDRAULIC FLUID MATERIAL PROPERTIES"  Style="{StaticResource smallHeader}"/>
            
            <TextBlock Grid.Column="0" Grid.Row="1" Text="Mass density" Margin="0,0,4,0" VerticalAlignment="Center"/>
            <TextBlock Grid.Column="1" Grid.Row="1" Text=" ρ = " FontStyle="Italic" VerticalAlignment="Center" TextAlignment="Right"/>
            <xctk:WatermarkTextBox Grid.Column="2" Grid.Row="1" TextAlignment="Right" Text="{Binding Path=Density}" Watermark="Density" WatermarkTemplate="{StaticResource wmTmplt}"/>
            <TextBlock Grid.Column="3" Grid.Row="1" Text=" t/mm³" VerticalAlignment="Center"/>
            
            <TextBlock Grid.Column="0" Grid.Row="2" Text="Bulk modulus" Margin="0,0,4,0" VerticalAlignment="Center"/>
            <TextBlock Grid.Column="1" Grid.Row="2" TextAlignment="Right" Text=" K = " FontStyle="Italic" VerticalAlignment="Center"/>
            <xctk:WatermarkTextBox Grid.Column="2" Grid.Row="2" TextAlignment="Right" Text="{Binding Path=BulkModulus}" Watermark="Bulk modulus" WatermarkTemplate="{StaticResource wmTmplt}"/>
            <TextBlock Grid.Column="3" Grid.Row="2" Text=" MPa" VerticalAlignment="Center"/>
        </Grid>
    </DataTemplate>
    <!-- template for MarlowUniaxialMaterial -->
    <DataTemplate DataType="{x:Type mmodels:MarlowUniaxialMaterial}">
        <Grid Margin="12, 0, 0, 0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <TextBlock Text="MARLOW UNIAXIAL TEST DATA" Grid.Row="0"  Style="{StaticResource smallHeader}"/>
            <DataGrid ItemsSource="{Binding UniaxialTestData}" 
                                                  Grid.Row="1"
                                                  MaxHeight="324"
                                                  ScrollViewer.CanContentScroll="True"
                                                  ScrollViewer.VerticalScrollBarVisibility="Auto"
                                                  ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                                  BorderThickness="0" 
                                                  GridLinesVisibility="Horizontal" 
                                                  HorizontalGridLinesBrush="LightGray" 
                                                  VerticalGridLinesBrush="LightGray" 
                                                  AlternatingRowBackground="#F0F0F0" 
                                                  HeadersVisibility="Column"
                                                  CanUserResizeRows="False"
                                                  AutoGenerateColumns="False"
                                                  ColumnHeaderStyle="{StaticResource rightAlignedColHdr}"
                                                  CellStyle="{StaticResource matPropCell}">
                <DataGrid.Columns>
                    <DataGridTextColumn Binding="{Binding Stress, StringFormat={}{0:F3}}" Header="Stress (MPa)" Width="100" CanUserSort="False"/>
                    <DataGridTextColumn Binding="{Binding Strain, StringFormat={}{0:F3}}" Header="Strain" Width="100" CanUserSort="False"/>
                </DataGrid.Columns>
            </DataGrid>
        </Grid>
    </DataTemplate>
    <!-- template for NonlinearSpringBehavior -->
    <DataTemplate DataType="{x:Type mmodels:NonlinearSpringBehavior}">
        <Grid Margin="12, 0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <TextBlock Text="NON-LINEAR SPRING BEHAVIOR" Grid.Row="0"  Style="{StaticResource smallHeader}"/>
            <DataGrid ItemsSource="{Binding ForceDeflectionCurve}" 
                                                  Grid.Row="1"
                                                  MaxHeight="324"
                                                  ScrollViewer.CanContentScroll="True"
                                                  ScrollViewer.VerticalScrollBarVisibility="Auto"
                                                  ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                                  BorderThickness="0" 
                                                  GridLinesVisibility="Horizontal" 
                                                  HorizontalGridLinesBrush="LightGray" 
                                                  VerticalGridLinesBrush="LightGray" 
                                                  AlternatingRowBackground="#F0F0F0" 
                                                  HeadersVisibility="Column"
                                                  CanUserResizeRows="False"
                                                  AutoGenerateColumns="False"
                                                  ColumnHeaderStyle="{StaticResource rightAlignedColHdr}"
                                                  CellStyle="{StaticResource matPropCell}">
                <DataGrid.Columns>
                    <DataGridTextColumn Binding="{Binding Force, StringFormat={}{0:F3}}" Header="Force (N)" Width="100" CanUserSort="False"/>
                    <DataGridTextColumn Binding="{Binding Deflection, StringFormat={}{0:F3}}" Header="Deflection (mm)" Width="100" CanUserSort="False"/>
                </DataGrid.Columns>
            </DataGrid>
        </Grid>
    </DataTemplate>
    <!-- template for LayeredAnnulusFibers (effectively a named list of AnnulusFiberLayer objects) -->
    <DataTemplate DataType="{x:Type core:LayeredAnnulusFibers}">
        <Grid Margin="12, 0, 0, 0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="auto"/>
                <ColumnDefinition Width="auto"/>
            </Grid.ColumnDefinitions>
            <Grid Grid.Column="0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto"/>
                </Grid.RowDefinitions>
                <ListView                     
                    BorderBrush="#F0F0F0" 
                    Background="#FBFBFB" 
                    ItemsSource="{Binding Layers}" 
                    SelectedIndex="0" 
                    x:Name="layers">
                    <!-- display materials' names -->
                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Name}" Padding="4,2,8,2"/>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
            </Grid>
            <ContentControl 
                Grid.Column="1"
                DataContext="{Binding ElementName=layers, Path=SelectedItem}" 
                Content="{Binding}" 
                Resources="{StaticResource materialEditorTemplates}"/>
        </Grid>
    </DataTemplate>
    <!-- template for a single AnnulusFiberLayer -->
    <DataTemplate DataType="{x:Type mmodels:AnnulusFiberLayer}">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="auto"/>
                <RowDefinition Height="auto"/>
            </Grid.RowDefinitions>
            <Grid Margin="12, 0, 0, 16" Grid.Row="0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto" MinWidth="120"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <TextBlock Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="4" Text="FIBER ORIENTATION" Style="{StaticResource smallHeader}"/>
                <TextBlock Grid.Column="0" Grid.Row="1" Text="{x:Static p:Resources.AnteriorFiberAngle}" Margin="0,0,4,0" VerticalAlignment="Center"/>
                <TextBlock Grid.Column="1" Grid.Row="1" Text=" α = " FontStyle="Italic" VerticalAlignment="Center" TextAlignment="Right"/>
                <xctk:WatermarkTextBox Grid.Column="2" Grid.Row="1" TextAlignment="Right" VerticalAlignment="Center" Text="{Binding Path=AnteriorFiberAngle}" Watermark="{x:Static p:Resources.AnteriorFiberAngle}" WatermarkTemplate="{StaticResource wmTmplt}"/>
                <TextBlock Grid.Column="3" Grid.Row="1" Text=" deg" VerticalAlignment="Center"/>
                <TextBlock Grid.Column="0" Grid.Row="2" Text="{x:Static p:Resources.PosteriorFiberAngle}" Margin="0,0,4,0" VerticalAlignment="Center"/>
                <TextBlock Grid.Column="1" Grid.Row="2" Text=" ψ = " FontStyle="Italic" VerticalAlignment="Center"/>
                <xctk:WatermarkTextBox Grid.Column="2" Grid.Row="2" TextAlignment="Right" VerticalAlignment="Center" Text="{Binding Path=PosteriorFiberAngle}" Watermark="{x:Static p:Resources.PosteriorFiberAngle}" WatermarkTemplate="{StaticResource wmTmplt}"/>
                <TextBlock Grid.Column="3" Grid.Row="2" Text=" deg" VerticalAlignment="Center"/>            
            </Grid>
            <ContentControl 
                Grid.Row="1"
                DataContext="{Binding}" 
                Content="{Binding Path=FiberMaterialProperties}" 
                Resources="{StaticResource materialEditorTemplates}"/>
        </Grid>
    </DataTemplate>
</ResourceDictionary>